#$cmake --vision
cmake_minimum_required(VERSION 3.5)
add_compile_options(-g -O0 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack)

if(UNIX)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")

endif()


#Set the project name
project(masterServer)

#include_directories(/usr/local/include)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
string(TIMESTAMP BUILD_TIMESTAMP "%Y%m%d%H%M%S")
configure_file(
	"${PROJECT_SOURCE_DIR}/version.h.in"
	"${PROJECT_BINARY_DIR}/include/version.h"
)

SET(SOURCES
    src/main.cpp
    src/CommonMaster.cpp
	src/SocketBase.cpp
	src/SocketServer.cpp
    src/RapidJson.cpp
	src/RedisHandler.cpp
    src/RrConfig.cpp
    src/EpollModule.cpp
    src/QueueModule.cpp
	log/Log.cpp
)

# Add an executable
add_executable(masterServer ${SOURCES})

target_include_directories(masterServer
    PUBLIC 
    ${PROJECT_SOURCE_DIR}/include
	${PROJECT_SOURCE_DIR}/log
	${PROJECT_SOURCE_DIR}/third_party/HwSecureC/include
	${PROJECT_SOURCE_DIR}/third_party/HwSecureC/libs
	/usr/local/include
	/usr/local/include/oatpp-1.3.0/oatpp
)

#link the library pthread
target_link_libraries(masterServer 
	liblog4cplus.so
	libhiredis.so
	libuuid.so
	securec
	oatpp
	-pthread
)

